# @Version        : 1.0
# @Update Time    : 2024/12/11 21:20
# @File           : operation_record_schema.py
# @IDE            : PyCharm
# @Desc           : 文件描述信息
from pydantic import Field

from src.common.typing.schema_typing import DatetimeStr
from src.core.base import BaseSchema
from typing import Optional


class OperationRecordSchema(BaseSchema):
    """
    操作日志
    """

    username: Optional[str] = Field(None, description="用户名")
    client_ip: Optional[str] = Field(None, description="客户端ip")
    request_api: Optional[str] = Field(None, description="请求api")
    method: Optional[str] = Field(None, description="请求方法")
    api_path: Optional[str] = Field(None, description="请求路径")
    status_code: Optional[int] = Field(None, description="状态码")
    params: Optional[str] = Field(None, description="请求参数")
    cost_time: Optional[float] = Field(None, description="耗时")
    summary: Optional[str] = Field(None, description="摘要")
    description: Optional[str] = Field(None, description="描述")
    tags: Optional[str] = Field(None, description="标签")
    system: Optional[str] = Field(None, description="系统")
    browser: Optional[str] = Field(None, description="浏览器")
    route_name: Optional[str] = Field(None, description="路由名称")
    content_length: Optional[int] = Field(None, description="请求长度")
    request_id: Optional[str] = Field(None, description="请求id")
    # 创建时间
    created_at: Optional[DatetimeStr] = Field(None, description="创建时间")
